home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-21 | 11.0 KB | 299 lines | [TEXT/Moml] |
- 21Oct95 e <e@flavors.com>
-
- Read README.Mac first.
-
- I used Metrowerks Codewarrior 6 to port Moscow ML 1.30.
- I used Metrowerks Codewarrior 7 to port Moscow ML 1.31.
- The Codewarrior 7 project files are included.
-
- Because mosmlyac and runtime have identically named files in them, I
- found it necessary to rename folder "runtime" to "!runtime" so Metrowerks
- would choose the right files. I could have also solved this problem by
- putting the project files into the runtime folder (as I did by putting the
- mosmlyac project into mosmlyac) but I didn't. Why? I like to debug from the
- Metrowerks debugger and so I want the project to live in the same directory
- as the finished application.
-
- The directory structure to three levels is as follows:
-
- ANSIshellƒ -- the eConsole & eEdit sources
- <lots of files>
- mosml folder
- e_mac -- mosml <-> eConsole & MacOS glue
- dirent.h
- e_access.c
- e_dirent.c
- e_filelink.c
- e_getenv.c
- e_gettimeofday.c
- e_graph.c
- m.h
- mac_os.c
- mac_os.h
- momlmenus.c
- momlmenus.h
- mosml.µ.rsrc
- os_mac_cmdmenu.c
- os_mac_options.h
- s.h
- sys/param.h
- sys/resource.h
- sys/stat.h
- sys/time.h
- sys/times.h
- sys/types.h
- sys/unistd.h
- sys/utsname.h
- ui.h
- uio.c
- mosml.image -- toplevel includes make & link
- mosml13m68 -- 68k application
- mosml13m68.µ -- 68k project
- mosml13ppc -- ppc application
- mosml13ppc.µ -- ppc project
- mosmllexe -- the lexer
- README.Mac
- README.MacDev
- src
- !runtime...
- compiler...
- lex...
- mosmllib...
- mosmlyac...
- test...
- tools...
- toolssrc...
-
- With all the files in place, mosml13m68 and mosml13ppc can be re-built
- from the sources simply by opening their project files and doing
- a Make. You'll need MetroWerks CodeWarrior 7. [It may be necessary to
- fix a path for ANSIShellƒ in the Load Paths preferences. In version 7
- CodeWarrior seems to have forgotten how to maintain relative paths.]
-
- Well, I lied. There's a bit of pre-processing of the files that in UNIX
- versions of mosml takes place via sed, awk, perl, cpp, etc. Some of these
- intermediate files are provided in this Mac version in the xtra folder.
- If you have sed, awk, perl, cpp, etc. then you may prefer to grok the
- make scripts and generate these files yourself -- it is safer to do so
- since they are generated from sources independent of this archive.
-
- Here are some basic rules:
-
- .grm files are processed by mosmlyac, which is supplied. Move mosmlyac
- temporarily to the folder with the .grm file, launch it, type in the .grm
- file name, and that's it. Move mosmlyac back to its folder.
-
- .lex files are processed with mosmllex, which is also supplied. The file
- !macuseful.sml has a few command lines which can be used with mosml to
- process the .lex files in the usual distribution.
-
- .mlp files are processed by cpp, the C pre-processor. I do this by hand
- since the MetroWerks compiler is freaked out by ML syntax.
-
- A few other files must be created using sed, awk, and perl. I've supplied
- all of these intermediate files since these tools are not widely used on
- the Mac. A few perl droplets are supplied anyway in case you need to redo
- my work. Drop runtime's instruct.h onto mksmlopc to make Opcodes.sml.
- Launch mksmlpre and supply the command line...
- ::!runtime:globals.h ::!runtime:fail.h
- to make Predef.sml. Making Prim_c.sml (and prims.c) is harder since it
- first requires making the file "primitives" [which requires sed and awk
- and running a UNIX shell script, if you believe the make file]. Once you
- have primitives [I made mine by hand] you can drop it onto mksmlprc to make
- Prim_c.sml.
-
- If you already have the mosml object files in your mosmllib (e.g., from
- the application release), the following step isn't necessary, just
- launch mosml13m68 or mosml13ppc. This step is only necessary when there
- are no object files in the mosmllib...
-
- With the existing or new mosml13m68 or mosml13ppc, you can recreate all
- the mosml object files by launching with the command key down and
- entering the command line:
- :mosml.image -P none -stdlib <path to mosml folder>:src:mosmllib:
-
- Then evaluate:
-
- val home = "Bang"; (* your path to the mosml folder goes here! *)
-
- moolevel := 2;
-
- (* to compile the toplevel mosml image and the lexer *)
-
- let val base = home ^ ":mosml:src:"
- in
- make "none" (base ^ "mosmllib") [] (base ^ "mosmllib");
- make "none" (base ^ "mosmllib") [] (base ^ "compiler");
- make "none" (base ^ "mosmllib") [(base ^ "compiler")] (base ^ "toolssrc");
- make "none" (base ^ "mosmllib") [(base ^ "compiler")] (base ^ "lex")
- end;
-
- (* to build the toplevel mosml image into file "testtop.image" *)
-
- let val base = home ^ ":mosml:src:"
- in
- chDir base; chDir "::";
- link "testtop.image"
- (true,true) (* -g -noheader *)
- "lorder" (base ^ "mosmllib") [(base ^ "compiler"),(base ^ "toolssrc")]
- ["Maine.uo"]
- end;
-
- (* another way to build the toplevel mosml image into file "testtop.image" *)
-
- let val base = home ^ ":mosml:src:"
- in
- chDir base; chDir "::";
- link "testtop.image"
- (true,true) (* -g -noheader *)
- "none" (base ^ "mosmllib") [(base ^ "compiler"),(base ^ "toolssrc")]
-
- ["List.uo", "Char.uo", "Strbase.uo", "String.uo", "BasicIO.uo",
- "Vector.uo", "Misc.uo", "Array.uo", "StringCvt.uo", "Word8.uo",
- "Word8Vector.uo", "CharVector.uo", "Word8Array.uo", "CharArray.uo",
- "Obj.uo", "Nonstdio.uo", "Substring.uo", "Path.uo", "Time.uo",
- "OS.uo", "FileSys.uo", "Lexing.uo", "Parsing.uo", "Miscsys.uo",
- "Printexc.uo", "Filename.uo", "Fnlib.uo", "Sort.uo", "Stack.uo",
- "Arg.uo", "Hasht.uo", "Memory.uo", "Config.uo", "Mixture.uo",
- "Const.uo", "Smlexc.uo", "Prim.uo", "Instruct.uo", "Lambda.uo",
- "Smlprim.uo", "Globals.uo", "Location.uo", "Units.uo", "Types.uo",
- "Smlperv.uo", "Asynt.uo", "Asyntfn.uo", "Parser.uo", "Lexer.uo",
- "Primdec.uo", "Infixst.uo", "Ovlres.uo", "Synchk.uo", "Infixres.uo",
- "Elab.uo", "Tr_env.uo", "Pr_lam.uo", "Match.uo", "Front.uo",
- "Back.uo", "Pr_zam.uo", "Opcodes.uo", "Prim_opc.uo", "Buffcode.uo",
- "Labels.uo", "Code_dec.uo", "Reloc.uo", "Emitcode.uo", "Emit_phr.uo",
- "Sigmtch.uo", "Crc.uo", "Compiler.uo", "Predef.uo", "Prim_c.uo",
- "Symtable.uo", "Patch.uo", "Tr_const.uo", "Rtvals.uo", "Load_phr.uo",
- "Exec_phr.uo", "Link.uo", "Deppars.uo", "Deplex.uo",
- "Smltope.uo", "Maine.uo"]
- end;
-
- (* to build the lexer into file "mosmllex" *)
-
- let val base = home ^ ":mosml:src:"
- in
- chDir base; chDir "::";
- link "mosmllex"
- (true,true) (* -g -noheader *)
- "none" (base ^ "mosmllib") [(base ^ "lex"),(base ^ "compiler")]
-
- ["List.uo", "Vector.uo", "Array.uo", "Char.uo", "Strbase.uo",
- "String.uo", "StringCvt.uo", "Word8.uo", "Word8Vector.uo",
- "Word8Array.uo", "CharVector.uo", "CharArray.uo", "Obj.uo",
- "BasicIO.uo", "Nonstdio.uo", "Lexing.uo", "Parsing.uo",
- "Miscsys.uo", "Printexc.uo", "Filename.uo", "Fnlib.uo",
- "Sort.uo", "Arg.uo", "Hasht.uo", "Syntax.uo", "Scan_aux.uo",
- "Gram_aux.uo", "Grammar.uo", "Scanner.uo", "Lexgen.uo",
- "Output.uo", "Mainlex.uo"]
- end;
-
- (* *)
-
- This section is probably only of historical interest.
-
- Here is some detail about what I have done to make mosml work on the
- Mac...
-
- I already had The Caml Light 0.7 runtime working on the Mac with my own
- console/editor environment. This code (which I'll call eConsole)
- supplies some of the missing UNIX functions such as timers for user,
- system, and gc, and of course, terminal i/o. Also for Caml Light and
- SML/NJ, I had implemented UNIX -> Mac pathname translation and included
- it in the runtime. This supports using UNIX created images (e.g.,
- mosmlcmp) in the Mac environment.
-
- So, step one was diff'ing mosml 1.30 and my custom Caml Light 0.7
- runtimes to merge my stuff in. This was not hard; although mosml seems
- to be based on an early 0.7 beta, I got my stuff in easily. A few
- changes were required for the MetroWerks 68k compiler. I also added in
- my user, system, and gc timer.
-
- Then I created replacements for some of the missing UNIX functions.
- These include access, readdir, etc. I also made several files such as
- "sys/unistd.h" that are simply one line: #include <unistd.h>. This makes
- modification of the mosml sources that include "sys/xxx.h" files
- unnecessary. It also makes a convenient place to put special unixfoolery
- such as defining F_OK, and overriding MWERKS flawed implementations,
- e.g., of chdir.
-
- It was also necessary to add a couple macros to mosml.c to adjust the
- Mac time (1904 base) to UNIX time (1970 base) and back.
-
- Then I could compile and link the world. I did this one file at a time.
- [Now that I have made make, this will never again be necessary!?]
-
- The SML changes I made were few.
-
- In mosmllib I hooked in my gc timer (UNIX and DOS don't have one), I
- hooked in osInfo (sml_uname), and fixed or worked around a couple bugs
- [these are now reported/fixed]. The changed files are:
-
- Mosml.sml gc timer
- Timer.sml gc timer
- OS.sml sml_uname (should be changed: OS.mlp)
-
- FileSys.sml -- I used the DOS version at first, then custom
- Path.sml -- I used the UNIX version at first, then custom
-
- and these files which, I think, are equivalent to what cpp would have
- done:
-
- Array.sml
- Integer.sml
- Strbase.sml
- Vector.sml
- Word.sml
- Word8Array.sml
- Word8Vector.sml
-
- In compiler I changed:
-
- Smltop.sml to add chDir and gc_full_major
- Link.sml to make missing_globals a ref
- Symtable.sml to add protect_linker_tables
- Symtable.sig to make this visible
-
- The purpose of the linker chages is twofold. In order to do a link in a
- toplevel environment it is necessary to save and restore the current
- environment. All the effected data are in the Symtable unit [as I said
- above, this isn't well tested]. protect_linker_tables was added to to
- this job. The second part of the change in to make missing_globals a
- ref. This change was also made by INRIA at my request in Caml Light.
- This is needed because the missing_globals hashtable gets very big for
- some links, and never shrinks. In fact is seems to get bigger with
- every link. To conserve memory the new link disposes the table after
- every link.
-
- I also created:
-
- Opcodes.sml
- Predef.sml
- Parser.sig
- Parser.sml
- Filename.sml
- Config.sml
- Lexer.sml
-
- from the requisite sources.
-
- Then I added the new sources for Smltope and Maine.
-
- The only files I changed in runtime are:
-
- mosml.c Mac <-> UNIX time, e_getrusage
- floats.c used Caml Light 0.7 version (has my compiler fixes)
- misc.c kill bogus malloc prototype
- minor_gc.c gc timer
- major_gc.c gc timer
- misc.h includes <stdlib.h> for malloc bug
- prims.c generated file
- main.c [I don't remember, I'll diff it later]
- interp.c punt spin (it's in ui.h)
- fail.c #define MAXDOUBLE
- config.h MWERKS friendly m.h & s.h includes
- sys.c UNIX -> Mac pathname translation
-
- I also added a bunch of new files for eConsole and unixfoolery.
-
- e
-